import Vue from "vue";
import Vuex from "vuex"
//导入保存数据的依赖
import VuePersistedStatePlugin from "vuex-persistedstate"

import userStore from './modules/user'

Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
        count: 0
    },
    modules: {
        userStore
    },
    plugins: [
        VuePersistedStatePlugin({
            storage: window.localStorage,
            reducer(data) {
                return {
                    userStore: data.userStore
                }
            }
        })
    ]
})

export default store;